﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Data;

namespace PMSSys
{
    class followupController
    {
        private DBconnentor dbConnect;
        public DBconnentor DbConnect
        {
            set { dbConnect = value; }
        }

        public bool addFue(FUE fue)
        {
            MySqlCommand query = new MySqlCommand(@"INSERT INTO followup( p_id,  follow_date,  blood_hgbhct,  blood_wbc,  blood_bseg_lympho,  blood_blast,  blood_platelets,  blood_anc,  blood_eos_mono,
            probfever,  probbleeding,  probpain,  probapetite,  probothers,  pp_temp,  pp_hr_bp,  ppadenophaty,  ppabdomen,  ppskin,  pprectal,
            ppsensory,  ppweight,  ppheent,  ppchest_lungs,  ppliver,  ppextremities,  ppneuro,  ppheight,  ppmucosa,  ppheart,  ppspleen,
            ppgenitalla,  ppmotor,  ppdtr,  chemonotes,  intrathetcaltransfusion,  intrathetcalprbc ,  intrathetcalplatelet,  intrathetcalffp,  intrathetcalbma,
            intrathetcalcryo,  intrathetcalcorebiop,  intrathetcalothers,   next_followup) 
            VALUES( @P_ID, @FOLLOW_DATE, @BLOOD_HGBHCT, @BLOOD_WBC, @BLOOD_BSEG_LYMPHO, @BLOOD_BLAST, @BLOOD_PLATELETS, @BLOOD_ANC, @BLOOD_EOS_MONO,
            @PROBFEVER,  @PROBBLEEDING,  @PROBPAIN,  @PROBAPETITE,  @PROBOTHERS,  @PP_TEMP,  @PP_HR_BP,  @PPADENOPHATY,  @PPABDOMEN,  @PPSKIN,  @PPRECTAL,
            @PPSENSORY,  @PPWEIGHT, @PPHEENT, @PPCHEST_LUNGS, @PPLIVER, @PPEXTREMITIES, @PPNEURO, @PPHEIGHT,  @PPMUCOSA,  @PPHEART,  @PPSPLEEN,
            @PPGENITALLA,  @PPMOTOR,  @PPDTR,  @CHEMONOTES,  @INTRATHETCALTRANSFUSION,  @INTRATHETCALPRBC,  @INTRATHETCALPLATELET,  
            @INTRATHETCALFFP,  @INTRATHETCALBMA, @INTRATHETCALCRYO,  @INTRATHETCALCOREBIOP,  @INTRATHETCALOTHERS,   @NEXT_FOLLOWUP)", dbConnect.getConnection());

            query.Parameters.Add(new MySqlParameter("@P_ID", MySqlDbType.Int32)).Value = fue.PatientID;
            query.Parameters.Add(new MySqlParameter("@FOLLOW_DATE", MySqlDbType.DateTime)).Value = fue.FueDate;
            query.Parameters.Add(new MySqlParameter("@BLOOD_HGBHCT", MySqlDbType.String)).Value = fue.Blood_hgbhct;
            query.Parameters.Add(new MySqlParameter("@BLOOD_WBC", MySqlDbType.String)).Value = fue.Blood_wbc;
            query.Parameters.Add(new MySqlParameter("@BLOOD_BSEG_LYMPHO", MySqlDbType.String)).Value = fue.Blood_bseg_lympho;
            query.Parameters.Add(new MySqlParameter("@BLOOD_BLAST", MySqlDbType.String)).Value = fue.Blood_blast;
            query.Parameters.Add(new MySqlParameter("@BLOOD_PLATELETS", MySqlDbType.String)).Value = fue.Blood_platelets;
            query.Parameters.Add(new MySqlParameter("@BLOOD_ANC", MySqlDbType.String)).Value = fue.Blood_anc;
            query.Parameters.Add(new MySqlParameter("@BLOOD_EOS_MONO", MySqlDbType.String)).Value = fue.Blood_eos_mono;
            query.Parameters.Add(new MySqlParameter("@PROBFEVER", MySqlDbType.String)).Value = fue.Probfever;
            query.Parameters.Add(new MySqlParameter("@PROBBLEEDING", MySqlDbType.String)).Value = fue.Probbleeding;
            query.Parameters.Add(new MySqlParameter("@PROBPAIN", MySqlDbType.String)).Value = fue.Probpain;
            query.Parameters.Add(new MySqlParameter("@PROBAPETITE", MySqlDbType.String)).Value = fue.Probapetite;
            query.Parameters.Add(new MySqlParameter("@PROBOTHERS", MySqlDbType.String)).Value = fue.Probothers;
            query.Parameters.Add(new MySqlParameter("@PP_TEMP", MySqlDbType.String)).Value = fue.Ppe_temp;
            query.Parameters.Add(new MySqlParameter("@PP_HR_BP", MySqlDbType.String)).Value = fue.Ppe_hr_bp;
            query.Parameters.Add(new MySqlParameter("@PPADENOPHATY", MySqlDbType.String)).Value = fue.Ppadenophaty;
            query.Parameters.Add(new MySqlParameter("@PPABDOMEN", MySqlDbType.String)).Value = fue.Ppabdomen;
            query.Parameters.Add(new MySqlParameter("@PPSKIN", MySqlDbType.String)).Value = fue.Ppskin;
            query.Parameters.Add(new MySqlParameter("@PPRECTAL", MySqlDbType.String)).Value = fue.Pprectal;
            query.Parameters.Add(new MySqlParameter("@PPSENSORY", MySqlDbType.String)).Value = fue.Ppsensory;
            query.Parameters.Add(new MySqlParameter("@PPWEIGHT", MySqlDbType.String)).Value = fue.Ppweight;
            query.Parameters.Add(new MySqlParameter("@PPHEENT", MySqlDbType.String)).Value = fue.Ppheent;
            query.Parameters.Add(new MySqlParameter("@PPCHEST_LUNGS", MySqlDbType.String)).Value = fue.Ppchest;
            query.Parameters.Add(new MySqlParameter("@PPLIVER", MySqlDbType.String)).Value = fue.Ppliver;
            query.Parameters.Add(new MySqlParameter("@PPEXTREMITIES", MySqlDbType.String)).Value = fue.Ppextremities;
            query.Parameters.Add(new MySqlParameter("@PPNEURO", MySqlDbType.String)).Value = fue.Ppneuro;
            query.Parameters.Add(new MySqlParameter("@PPHEIGHT", MySqlDbType.String)).Value = fue.Ppheight;
            query.Parameters.Add(new MySqlParameter("@PPMUCOSA", MySqlDbType.String)).Value = fue.Ppmucosa;
            query.Parameters.Add(new MySqlParameter("@PPHEART", MySqlDbType.String)).Value = fue.Ppheart;
            query.Parameters.Add(new MySqlParameter("@PPSPLEEN", MySqlDbType.String)).Value = fue.Ppspleen;
            query.Parameters.Add(new MySqlParameter("@PPGENITALLA", MySqlDbType.String)).Value = fue.Ppgenitalla;
            query.Parameters.Add(new MySqlParameter("@PPMOTOR", MySqlDbType.String)).Value = fue.Ppmotor;
            query.Parameters.Add(new MySqlParameter("@PPDTR", MySqlDbType.String)).Value = fue.Ppdtr;
            query.Parameters.Add(new MySqlParameter("@CHEMNOTES", MySqlDbType.String)).Value = fue.Chemonotes;
            query.Parameters.Add(new MySqlParameter("@INTRATHETCALTRANSFUSION", MySqlDbType.String)).Value = fue.Intrathetcaltransfusion;
            query.Parameters.Add(new MySqlParameter("@INTRATHETICALPRBC", MySqlDbType.String)).Value = fue.Intrathetcalprbc;
            query.Parameters.Add(new MySqlParameter("@INTRATHECALPLATELET", MySqlDbType.String)).Value = fue.Intrathetcalplatelet;
            query.Parameters.Add(new MySqlParameter("@INTRATHECALFFP", MySqlDbType.String)).Value = fue.Intrathetcalffp;
            query.Parameters.Add(new MySqlParameter("@INTRATHECALBMA", MySqlDbType.String)).Value = fue.Intrathetcalbma;
            query.Parameters.Add(new MySqlParameter("@INTRATHECALCRYO", MySqlDbType.String)).Value = fue.Intrathetcalcryo;
            query.Parameters.Add(new MySqlParameter("@INTRATHECALCOREBIOP", MySqlDbType.String)).Value = fue.Intrathetcalcorebiop;
            query.Parameters.Add(new MySqlParameter("@INTRATHECALOTHERS", MySqlDbType.String)).Value = fue.Intrathetcalothers;
            query.Parameters.Add(new MySqlParameter("@NEXT_FOLLOWUP", MySqlDbType.String)).Value = fue.NextFueDate;

            return dbConnect.nonQueryExecute(query);     
        }
        public DataTable getDataTable(int p_id)
        {
            string str = "SELECT fue_id, follow_date AS `Date Issued`, next_followup AS `Next Follow-Up Date` FROM followup WHERE p_id = " + p_id.ToString();
            return dbConnect.view(str);
        }
    }
}
